﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using KPIS.GERP.Models.Class;

namespace KPIS.GERP.Models.ICM
{
    //public enum ComId{DN, BD, BDO, BDD, PPR, PR, PO}
    [DataContract, Table("IcmCommittee")]
    public class Committee
    { 
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DataMember, Display(Name = "CommitteeId", ResourceType = typeof(Resources.CommitteeResource))]
        public int CommitteeId { get; set; }

        [ForeignKey("CommitteeGroup")]
        [DataMember, Display(Name = "RefId", ResourceType = typeof(Resources.CommitteeResource))]
        public int? CommitteeGroupId { get; set; }

        [DataMember]
        public virtual CommitteeGroup CommitteeGroup { get; set; }

        //[ForeignKey("SysProcess")]
        //[DataMember, Display(Name = "RefType", ResourceType = typeof(Resources.CommitteeResource))]
        //public int RefType { get; set; }

        [ForeignKey("CommitteeFunction")]
        [DataMember, Display(Name = "ComFunctionId", ResourceType = typeof(Resources.CommitteeResource))]
        public int? ComFunctionId { get; set; }

        [ForeignKey("CommitteePosition")]
        [DataMember, Display(Name = "ComPositionId", ResourceType = typeof(Resources.CommitteeResource))]
        public int? ComPositionId { get; set; }

        [CustomRequired]
        [DataMember, Display(Name = "Code", ResourceType = typeof(Resources.CommitteeResource))]
        public string Code { get; set; }

        [ForeignKey("CommitteeType")]
        [DataMember, Display(Name = "ComTypeId", ResourceType = typeof(Resources.CommitteeResource))]
        public int? ComTypeId { get; set; }

        [ForeignKey("Employee")]
        [DataMember, Display(Name = "EmpId", ResourceType = typeof(Resources.CommitteeResource))]
        public int? EmpId { get; set; }

        [CustomRequired]
        [DataMember, Display(Name = "EmpName", ResourceType = typeof(Resources.CommitteeResource))]
        public string EmpName { get; set; }

        [DataMember, Display(Name = "EmpPositionName", ResourceType = typeof(Resources.CommitteeResource))]
        public string EmpPositionName { get; set; }

        [DataType(DataType.MultilineText)]
        [DataMember, Display(Name = "DeleteReason", ResourceType = typeof(Resources.CommitteeResource))]
        public string DeleteReason { get; set; }

        //[ForeignKey("PrePurchaseRequest")]
        //[DataMember, Display(Name = "PprId", ResourceType = typeof(Resources.CommitteeResource))]
        //public int? PprId { get; set; }
        
        #region RecordStatus

        [DataMember, Display(Name = "RecordStatus", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
        public string RecordStatus { get; set; }

        [DataMember, Display(Name = "CreatedBy", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
        public int? CreatedBy { get; set; }

        [DataMember, Display(Name = "CreatedWhen", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
        public DateTime? CreatedWhen { get; set; }

        [DataMember, Display(Name = "UpdatedBy", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
        public int? UpdatedBy { get; set; }

        [DataMember, Display(Name = "UpdatedWhen", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
        public DateTime? UpdatedWhen { get; set; }

        #endregion

        [DataMember]
        public IcmMasLookUp CommitteeFunction { get; set; }

        [DataMember]
        public IcmMasLookUp CommitteePosition { get; set; }

        [DataMember]
        public IcmMasLookUp CommitteeType { get; set; }

        //[DataMember]
        //public IcmMasLookUp SysProcess { get; set; }

        //[DataMember]
        //public PrePurchaseRequest PrePurchaseRequest { get; set; }

        [DataMember]
        public HRM.Employee Employee { get; set; }
    }
}
